<template>
	<view id="order">
		<Header txt="购买订单" v-if="baidu"></Header>
		<HeaderB txt="购买订单" v-if="!baidu"></HeaderB>
		<view class="item">
			<text class="title">已选择套餐</text>
			<view class="iblock">
				<view class="content" @click="useOutClickSide">
				    <easy-select ref="easySelect" size="medium" :value="selecValue1" 
					:options='[{value:1,label:"高效代理"},
								{value:3,label:"独享代理"},
								{value:4,label:"动态代理(按量)"},
								{value:8,label:"动态代理(按并发)"},
								{value:11,label:"虚拟代理"},
								{value:7,label:"长效代理"},
								{value:12,label:"全局代理"},
								{value:14,label:"加速器标准版"},
								{value:16,label:"加速器包机版"},
								{value:15,label:"包量套餐(升级版)"},]' @selectOne="selectOne1">
					</easy-select>
				</view>
			</view>			
		</view>
		<view class="item"  v-if="showItem == 7">
			<text class="title">IP分类：</text>
			<view class="iblock">
				<view class="content" @click="useOutClickSide">
				    <easy-select ref="easySelect" size="medium" :value="selecValue2" 
					:options='[{value:1,label:"24小时版"},{value:2,label:"静态IP"}]' @selectOne="selectOne2">
					</easy-select>
				</view>
			</view>			
		</view>
		<view class="item"  v-if="showItem == 1">
			<text class="title">已选择类型：</text>
			<view class="iblock">
				<view class="content" @click="useOutClickSide">
				    <easy-select ref="easySelect" size="medium" :value="selecValue5" 
					:options='[{value:1,label:"包量套餐"},{value:5,label:"不限量(极速版)"},{value:3,label:"不限量(个人版)"},{value:4,label:"不限量(企业版)"}]' @selectOne="selectOne5">
					</easy-select>
				</view>
			</view>			
		</view>
		<view class="item"  v-if="showItem == 15">
			<text class="title">已选择类型：</text>
			<view class="iblock">
				<view class="content" @click="useOutClickSide">
				    <easy-select ref="easySelect" size="medium" :value="selecValue6" 
					:options='[{value:1,label:"1~3分钟"},
								{value:2,label:"3~10分钟"},
								{value:3,label:"10~30分钟"},
								{value:4,label:"30分钟~2小时"},
								{value:5,label:"2~12小时"},
								{value:6,label:"12~24小时"},
								]' @selectOne="selectOne6">
					</easy-select>
				</view>
			</view>			
		</view>
		<view class="item" v-if="showItem == 8">
			<text class="title">并发数量：</text>
			<view class="iblock">
				<view class="block reduce" @click="reduce(1,5,100)">-</view>
				<view class="block">
					<input type="number" value="" v-model="form1.times" @input="inputN(1,100)"/>
				</view>
				<view class="block add" @click="add(1,5,100)">+</view>
				<!-- <uni-number-box class="numberBox" :min="0" :max="vmax" v-model="ruleForm.count" @change="getNumber"></uni-number-box> -->
			</view>
		</view>
		<view class="item"  v-if="
          (showItem == 1 && form1.type != '1') ||
          showItem == '3' ||
          showItem == '8' ||
          showItem == '9' ||
          showItem == '12' ||
          showItem == '7'
        ">
			<text class="title">套餐时长：</text>
			<view class="iblock">
				<view class="content" @click="useOutClickSide">
				    <easy-select ref="easySelect" size="medium" :value="selecValue3" 
					:options='[{value:1,label:"包天"},{value:30,label:"包月"},{value:180,label:"包半年"},{value:365,label:"包年"}]' @selectOne="selectOne3">
					</easy-select>
				</view>
			</view>			
		</view>
		<view class="item"  v-if="
		(showItem == '14' && form1.day14 != 1) || (showItem == '16' && form1.day14 != 1)
		">
			<text class="title">套餐时长：</text>
			<view class="iblock">
				<view class="content" @click="useOutClickSide">
				    <easy-select ref="easySelect" size="medium" :value="selecValue7" 
					:options='[{value:7,label:"包周"},{value:30,label:"包月"},{value:180,label:"包半年"},{value:365,label:"包年"}]' @selectOne="selectOne7">
					</easy-select>
				</view>
			</view>			
		</view>
		<view class="item"  v-if="
		(showItem == '14' && form1.day14 == 1) || (showItem == '16' && form1.day14 == 1)
		">
			<text class="title">套餐时长：</text>
			<text class="title"> 一周</text>		
		</view>
		<view class="item"  v-if="
		(showItem == '14' && form1.day14 == 1) || (showItem == '16' && form1.day14 == 1)
		">
			<text class="title">购买数量：</text>
			<text class="title"> 2</text>		
		</view>
		<view class="item"  v-if="showItem == 11">
			<text class="title">套餐时长：</text>
			<view class="iblock">
				<view class="content" @click="useOutClickSide">
				    <easy-select ref="easySelect" size="medium" :value="selecValue8" 
					:options='[{value:1,label:"1分钟"},{value:5,label:"5分钟"},{value:180,label:"3小时"},{value:720,label:"12小时"},{value:1440,label:"24小时"}]' @selectOne="selectOne8">
					</easy-select>
				</view>
			</view>			
		</view>
		<view class="item" v-if="
          showItem == 1 && form1.type != '3' && form1.type != '4' && form1.type != '5'
        ">
			<text class="title" v-if="form1.type == '1' || showItem == 15">代理数量：</text>
			<text class="title" v-if="showItem == 1 && form1.type == '2'">每日提取上限：</text>
			<view class="iblock">
				<view class="block">
					<view class="block reduce" @click="reduce(2,1000,10000000)">-</view>
					<view class="block">
						<input type="number" value="" v-model="form1.multiple" @input="inputN(2,10000000)"/>
					</view>
					<view class="block add" @click="add(2,1000,10000000)">+</view>
				</view>
			</view>
		</view>
		<view class="item" v-if="
          (showItem == 15 && this.form1.type15 == 1) ||
          (showItem == 15 && this.form1.type15 == 2) ||
          (showItem == 15 && this.form1.type15 == 3)
        ">
			<text class="title" >代理数量：</text>
			<view class="iblock">
				<view class="block">
					<view class="block reduce" @click="reduce(3,1000,10000000)">-</view>
					<view class="block">
						<input type="number" value="" v-model="form1.multiple15" @input="inputN(3)"/>
					</view>
					<view class="block add" @click="add(3,1000,10000000)">+</view>
				</view>
			</view>
		</view>
		<view class="item" v-if="
		  (showItem == 15 && this.form1.type15 == 4) ||
		  (showItem == 15 && this.form1.type15 == 5) ||
		  (showItem == 15 && this.form1.type15 == 6)          
		">
			<text class="title" >代理数量：</text>
			<view class="iblock">
				<view class="block">
					<view class="block reduce" @click="reduce(4,100,10000000)">-</view>
					<view class="block">
						<input type="number" value="" v-model="form1.multiple16" @input="inputN(4)"/>
					</view>
					<view class="block add" @click="add(4,100,10000000)">+</view>
				</view>
			</view>
		</view>
		<view class="item" v-if="
		  (showItem == 11 && form3.minutes == 1) || (showItem == 11 && form3.minutes == 5)        
		">
			<text class="title" >购买总数：</text>
			<view class="iblock">
				<view class="block">
					<view class="block reduce" @click="reduce(5,1000,10000000)">-</view>
					<view class="block">
						<input type="number" value="" v-model="form3.multiple" @input="inputN(5)"/>
					</view>
					<view class="block add" @click="add(5,1000,10000000)">+</view>
				</view>
			</view>
		</view>
		<view class="item" v-if="
		  (showItem == 11 && form3.minutes == 180) ||
		  (showItem == 11 && form3.minutes == 720) ||
		  (showItem == 11 && form3.minutes == 1440)                 
		">
			<text class="title" >购买总数：</text>
			<view class="iblock">
				<view class="block">
					<view class="block reduce" @click="reduce(6,100,10000000)">-</view>
					<view class="block">
						<input type="number" value="" v-model="form3.multiple2" @input="inputN(6)"/>
					</view>
					<view class="block add" @click="add(6,100,10000000)">+</view>
				</view>
			</view>
		</view>
		<view class="item" v-if="showItem == 14 && form1.day14 != 1">
			<text class="title grouptit" >活动价格：</text>
			<view :class="[form1.day14Type==1? 'groud':'' , 'itmrad','groud1']" @click="radioChange(1)">
				<text >￥{{ payMoney14 }}</text>/窗口 | 1-29窗口
			</view>
			<view :class="[form1.day14Type==2? 'groud':'' , 'itmrad']" @click="radioChange(2)">
				<text >￥{{ payMoney1402 / 30 }}</text>/窗口 | 30+窗口
			</view>		
		</view>
		<view class="item" v-if="(showItem == '7'||showItem == '12') && form1.day == 1">
			<text class="title grouptit" >活动价格：</text>
			<view :class="[form1.day7Type==1? 'groud':'' , 'itmrad', 'itmrad1']" @click="radioChange2(1)">				
				<view>￥<text style="font-size: 24rpx">10</text>/个</view>
				<view class="day7Type_line"></view>
				<view class="day7Type_num">1-9个</view>
			</view>
			<view :class="[form1.day7Type==2? 'groud':'' , 'itmrad', 'itmrad1']" @click="radioChange2(2)">
				<image src="../../static/other/1.png" mode="aspectFit"></image>
				<view>￥<text style="font-size: 24rpx">8</text>/个</view>
				<view class="day7Type_line"></view>
				<view class="day7Type_num">10-39个</view>
			</view>
			<view :class="[form1.day7Type==3? 'groud':'' , 'itmrad', 'itmrad1']" @click="radioChange2(3)">
				<image src="../../static/other/2.png" mode="aspectFit"></image>
				<view>￥<text style="font-size: 24rpx">7</text>/个</view>
				<view class="day7Type_line"></view>
				<view class="day7Type_num">40-79个</view>
			</view>
			<view :class="[form1.day7Type==4? 'groud':'' , 'itmrad', 'itmrad1']" @click="radioChange2(4)">
				<image src="../../static/other/3.png" mode="aspectFit"></image>
				<view>￥<text style="font-size: 24rpx">5</text>/个</view>
				<view class="day7Type_line"></view>
				<view class="day7Type_num">80+个</view>
			</view>    
		</view>
		<view class="item"  v-if="(showItem == '7'||showItem == '12') && form1.day == 30">
			<text class="title grouptit" >活动价格：</text>
			<view :class="[form1.day7Type==1? 'groud':'' , 'itmrad', 'itmrad1']" @click="radioChange2(1)">
				<view>￥<text style="font-size: 24rpx">99</text>/个</view>
				<view class="day7Type_line"></view>
				<view class="day7Type_num">1-9个</view>
			</view>
			<view :class="[form1.day7Type==2? 'groud':'' , 'itmrad', 'itmrad1']" @click="radioChange2(2)">
				<image src="../../static/other/1.png" mode="aspectFit"></image>
				<view>￥<text style="font-size: 24rpx">79.2</text>/个</view>
				<view class="day7Type_line"></view>
				<view class="day7Type_num">10-39个</view>
			</view>
			<view :class="[form1.day7Type==3? 'groud':'' , 'itmrad', 'itmrad1']" @click="radioChange2(3)">
				<image src="../../static/other/2.png" mode="aspectFit"></image>
				<view>￥<text style="font-size: 24rpx">69.3</text>/个</view>
				<view class="day7Type_line"></view>
				<view class="day7Type_num">40-79个</view>
			</view>
			<view :class="[form1.day7Type==4? 'groud':'' , 'itmrad', 'itmrad1']" @click="radioChange2(4)">
				<image src="../../static/other/3.png" mode="aspectFit"></image>
				<view>￥<text style="font-size: 24rpx">49.5</text>/个</view>
				<view class="day7Type_line"></view>
				<view class="day7Type_num">80+个</view>
			</view>    
		</view>
		<view class="item" v-if="(showItem == '7'||showItem == '12') && form1.day == 180">
			<text class="title grouptit" >活动价格：</text>
			<view :class="[form1.day7Type==1? 'groud':'' , 'itmrad']" @click="radioChange2(1)">
				<view>￥<text style="font-size: 24rpx">559</text>/个</view>
				<view class="day7Type_line"></view>
				<view class="day7Type_num">1-9个</view>
			</view>
			<view :class="[form1.day7Type==2? 'groud':'' , 'itmrad']" @click="radioChange2(2)">
				<image src="../../static/other/1.png" mode="aspectFit"></image>
				<view>￥<text style="font-size: 24rpx">447.2</text>/个</view>
				<view class="day7Type_line"></view>
				<view class="day7Type_num">10-39个</view>
			</view>
			<view :class="[form1.day7Type==3? 'groud':'' , 'itmrad']" @click="radioChange2(3)">
				<image src="../../static/other/2.png" mode="aspectFit"></image>
				<view>￥<text style="font-size: 24rpx">391.3</text>/个</view>
				<view class="day7Type_line"></view>
				<view class="day7Type_num">40-79个</view>
			</view>
			<view :class="[form1.day7Type==4? 'groud':'' , 'itmrad']" @click="radioChange2(4)">
				<image src="../../static/other/3.png" mode="aspectFit"></image>
				<view>￥<text style="font-size: 24rpx">279.5</text>/个</view>
				<view class="day7Type_line"></view>
				<view class="day7Type_num">80+个</view>
			</view>    
		</view>
		<view class="item" v-if="(showItem == '7'||showItem == '12') && form1.day == 365">
			<text class="title grouptit" >活动价格：</text>
			<view :class="[form1.day7Type==1? 'groud':'' , 'itmrad']" @click="radioChange2(1)">
				<view>￥<text style="font-size: 24rpx">1069</text>/个</view>
				<view class="day7Type_line"></view>
				<view class="day7Type_num">1-9个</view>
			</view>
			<view :class="[form1.day7Type==2? 'groud':'' , 'itmrad']" @click="radioChange2(2)">
				<image src="../../static/other/1.png" mode="aspectFit"></image>
				<view>￥<text style="font-size: 24rpx">855.2</text>/个</view>
				<view class="day7Type_line"></view>
				<view class="day7Type_num">10-39个</view>
			</view>
			<view :class="[form1.day7Type==3? 'groud':'' , 'itmrad']" @click="radioChange2(3)">
				<image src="../../static/other/2.png" mode="aspectFit"></image>
				<view>￥<text style="font-size: 24rpx">748.3</text>/个</view>
				<view class="day7Type_line"></view>
				<view class="day7Type_num">40-79个</view>
			</view>
			<view :class="[form1.day7Type==4? 'groud':'' , 'itmrad']" @click="radioChange2(4)">
				<image src="../../static/other/3.png" mode="aspectFit"></image>
				<view>￥<text style="font-size: 24rpx">534.5</text>/个</view>
				<view class="day7Type_line"></view>
				<view class="day7Type_num">80+个</view>
			</view>    
		</view>
		<view class="item" v-if="showItem == 7 || showItem == 12">
			<text class="title">购买数量：</text>
			<view class="iblock">
				<view class="block reduce" @click="reduce(7,1,10000)">-</view>
				<view class="block">
					<input type="number" value="" v-model="form1.multipleTy7" @input="inputN(1)"/>
				</view>
				<view class="block add" @click="add(7,1,100)">+</view>
				<!-- <uni-number-box class="numberBox" :min="0" :max="vmax" v-model="ruleForm.count" @change="getNumber"></uni-number-box> -->
			</view>
		</view>
		<view class="item"  v-if="showItem == 14 && form1.day14 != 1">
			<text class="title">购买数量：</text>
			<view class="iblock">
				<view class="block reduce" @click="reduce(8,1,1000000)">-</view>
				<view class="block">
					<input type="number" value="" v-model="form1.timesNum" @input="inputN(8,1000000)"/>
				</view>
				<view class="block add" @click="add(8,1,1000000)">+</view>
				<!-- <uni-number-box class="numberBox" :min="0" :max="vmax" v-model="ruleForm.count" @change="getNumber"></uni-number-box> -->
			</view>
		</view>
		<view class="item"  v-if="showItem == 1 && form1.type == '3'">
			<text class="title">单次提取数量：</text>
			<view class="iblock">
				<view class="block reduce" @click="reduce(9,5,100)">-</view>
				<view class="block">
					<input type="number" value="" v-model="form1.number" @input="inputN(9,100)"/>
				</view>
				<view class="block add" @click="add(9,5,100)">+</view>
			</view>
		</view>
		<view class="item"  v-if="showItem == 1 && form1.type == '4'">
			<text class="title">单次提取数量：</text>
			<view class="iblock">
				<view class="block reduce" @click="reduce(10,10,100)">-</view>
				<view class="block">
					<input type="number" value="" v-model="form1.number2" @input="inputN(10,100)"/>
				</view>
				<view class="block add" @click="add(10,10,100)">+</view>
			</view>
		</view>
		<view class="item" v-if="showItem == 4">
			<text class="title">转发数量：</text>
			<view class="iblock">
				<view class="block reduce" @click="reduce(11,100000,1000000000)">-</view>
				<view class="block">
					<input type="number" value="" v-model="form2.multiple" @input="inputN(11,1000000000)"/>
				</view>
				<view class="block add" @click="add(11,100000,1000000000)">+</view>
			</view>
		</view>
		<view class="item" v-if="form1.day14 != 1">
			<text class="title">购买订单数：</text>
			<view class="iblock">
				<view class="block reduce" @click="reduce(12,1,1000)">-</view>
				<view class="block">
					<input type="number" value="" v-model="form1.number3" @input="inputN(12,1000)"/>
				</view>
				<view class="block add" @click="add(12,1,1000)">+</view>
			</view>
		</view>
		<view class="item"  v-if="
          (showItem == 1 && form1.type == 3 && form1.day == 1) ||
          (showItem == 1 && form1.type == 4 && form1.day == 1) ||
          (showItem == 1 && form1.type == 5 && form1.day == 1) ||
          (showItem == 3 && form1.day == 1) ||
          (showItem == 7 && form1.day == 1) ||  (showItem == 12 && form1.day == 1)
        " >
			<text class="title">购买天数：</text>
			<view class="iblock">
				<view class="block reduce" @click="reduce(13,1,29)">-</view>
				<view class="block">
					<input type="number" value="" v-model="dayvalue" @input="inputN(13,29)"/>
				</view>
				<view class="block add" @click="add(13,1,29)">+</view>
			</view>
		</view>
		<view class="item">
			<text class="title">优惠券：</text>
			<view class="iblock">
				<view class="content" @click="useOutClickSide">
				    <easy-select ref="easySelect" size="medium" :value="selecValue4" 
					:options='couponList' @selectOne="selectOne4">
					</easy-select>
				</view>
			</view>			
		</view>
		<view class="item">
			<text class="title">需要支付：</text>
			<view class="iblock">
				<text>{{money + "元"}}</text>
			</view>			
		</view>
		<view class="part2">
			<view class="">
				<view class="active" @click="change(5)" v-if="alipay==true">
					<image  src="https://iconimg.oss-cn-hangzhou.aliyuncs.com/%E7%86%8A%E7%8C%AB%E4%BB%A3%E7%90%86/%E5%9B%BE%E6%A0%87/zhifubao.png" mode="aspectFit"></image>
					<text>支付宝支付</text>
					<radio class="im" value="5" :checked="payType==5" color="#007AFF" />
				</view>
				<view class="active" @click="change(6)" v-if="weixin==true">
					<image  src="https://iconimg.oss-cn-hangzhou.aliyuncs.com/%E7%86%8A%E7%8C%AB%E4%BB%A3%E7%90%86/%E5%9B%BE%E6%A0%87/weixin.png" mode="aspectFit"></image>
					<text >微信支付</text>
					<radio class="im" value="6" :checked="payType==6" color="#007AFF" />
				</view>			
				<view class="active" @click="change(3)">
					<image  src="../../static/usercenter/wallet.png" mode="aspectFit"></image>
					<text >钱包支付（余额:{{nmoney}}）</text>
					<radio class="im" value="6" :checked="payType==3" color="#007AFF" />
				</view>
			</view>
		</view>
		<view class="prompt_text2">
			* 使用钱包支付时不可使用优惠券
		</view>
		<view class="btn" v-if="!isoptions">
			<button type="primary" @click="submit2">支付</button>
		</view>
		<view class="btn" v-if="!baidu">
			<button type="primary" @click="submit3">其他方式支付</button>
		</view>
	</view>
</template>

<script>	
	import QRCode  from '../../static/js/weapp-qrcode.js';　
	// import formatDate2  from  "../../common/com.js"
	export default {
		data() {
			return {
				isoptions:false,
				isoptions2:false,
				options:{
				        code: '',// 生成二维码的值
				        size: 200,
				        },
				html:'',
				showItem: null,
				form2: {
				  multiple: 100000,
				},
				form1: {
				  type: "1",
				  type2: "1",
				  multiple: 3000,
				  multiple2: 100000,
				  multiple3: 1000,
				  multiple15: 1000,
				  multiple16: 100,
				  day: 1,
				  day14: 7,
				  day14Type: 1,
				  timesNum: 2,
				  number: 5,
				  number2: 10,
				  number3: 1,
				  times: 5,
				  ipType: 1,
				  type15: 1,
				  multipleTy7: 1,
				  city: "0",
				  city2: "0",
				  day7Type: 1,
				},
				form3: {
				  multiple: 1000,
				  multiple2: 100,
				  minutes: 1,
				  times: 1000,
				},
				payType: 5,
				coupon: 0,
				couponDis: false,
				couponList: [{ label: "不使用优惠", value: 0 }],
				show1: false,
				money: 0,
				optionsCity: [],
				optionsCity2: [],
				payMoney1402: 0,
				payMoney14: 0,
				dayvalue: 1,
				activeShow: false,  
				selecValue1:'高效代理',
				selecValue2:'24小时版',
				selecValue3:'包天',
				selecValue4:'不使用优惠卷',
				selecValue5:'包量套餐',
				selecValue6:'1~3分钟',
				selecValue7:'包周',
				selecValue8:'1分钟',
				selecValue9:'',
				selecValue10:'',
				weixin:true,
				alipay:true,
				baidu:true
			};
		},
		onLoad(){
			// #ifdef MP-WEIXIN
			this.weixin=true
			this.alipay=false
			this.payType=6
			// #endif
			// #ifdef  MP-ALIPAY
			this.weixin=false
			this.alipay=true
			// #endif 
			// #ifdef MP-BAIDU
			this.weixin=false
			this.alipay=false
			this.payType=3
			// #endif
		},
		onShow(){
			// #ifdef MP-BAIDU
			this.baidu=false
			// #endif
			this.get()
			this.form1.number3 = 1;
			this.showItem = this.selectItem;
			if(this.showItem==1){
				this.selecValue1="高效代理"
			}else if(this.showItem==3){
				this.selecValue1="独享代理"
			}else if(this.showItem==4){
				this.selecValue1="动态代理(按量)"
			}else if(this.showItem==8){
				this.selecValue1="动态代理(按并发)"
			}else if(this.showItem==11){
				this.selecValue1="虚拟代理"
			}else if(this.showItem==7){
				this.selecValue1="长效代理"
			}else if(this.showItem==12){
				this.selecValue1="全局代理"
			}else if(this.showItem==14){
				this.selecValue1="加速器标准版"
			}else if(this.showItem==16){
				this.selecValue1="加速器包机版"
			}else if(this.showItem==15){
				this.selecValue1="包量套餐(升级版)"
			}
			this.form1.type = this.selectItem2;
			if (this.selectItem3 != undefined) {
			  this.form3.minutes = this.selectItem3;
			} else {
			  this.form3.minutes = 1;
			}
			if (this.showItem == 3 || this.showItem == 7 || this.showItem == 12) {
			  this.form1.day = this.selectItem3;
			}
			if (this.showItem == 14) {
			  if (this.form1.type == 1) {
			    this.form1.day14 = this.selectItem3;
			  }
			  if (this.form1.type == 2) {
			    this.form1.day14 = this.selectItem3;
			    this.showItem = 16;
			  }
			}
			if (this.showItem == 16) {
			  this.form1.day14 = this.selectItem3;
			}
			// this.getCity7();
			// this.getCity72();    
		},
		computed: {
			userInfo() {
				return this.$store.state.userInfo;
			},
			price() {
			  return this.$store.state.price;
			},
			selectItem() {
			  return this.$store.state.selectItem;
			},
			selectItem2() {
			  return this.$store.state.selectItem2;
			},
			selectItem3() {
			  return this.$store.state.selectItem3;
			},
			nmoney() {
			  return this.$store.state.leftMoney;
			},
			async payMoney() {
		      let that = this;
		      let payMoney = 0;
		      let tar = 0;
		      if (this.coupon != 0 && this.couponList.length > 1) {
		        this.couponList.forEach((item) => {
		          if (item.value == this.coupon) {
		            tar = item.label.substring(0, item.label.indexOf("元"));
		            return false;
		          }
		        });
		      }
		      let _data = {};
		      if (this.showItem == null) {
		        return payMoney;
		      }
		      // 高效代理
		      if (this.showItem == "1") {
		        // 按量
		        if (this.form1.type == 1) {
		          _data = {
		            tradeType: 1,
		            orderType: 1,
		            day: 0,
		            times: parseInt(this.form1.multiple / 1000),
		            saveOrderCount: this.form1.number3,
		          };
		        }
		        // 不限量个人
		        if (this.form1.type == 3) {
		          if (this.form1.day == 1) {
		            _data = {
		              tradeType: 1,
		              orderType: 3,
		              poolType: 1,
		              day: this.dayvalue,
		              saveOrderCount: this.form1.number3,
		              times: parseInt(this.form1.number / 5),
		            };
		          } else {
		            _data = {
		              tradeType: 1,
		              orderType: 3,
		              poolType: 1,
		              day: this.form1.day,
		              saveOrderCount: this.form1.number3,
		              times: parseInt(this.form1.number / 5),
		            };
		          }
		        }
		        // 不限量企业
		        if (this.form1.type == 4) {
		          if (this.form1.day == 1) {
		            _data = {
		              tradeType: 1,
		              orderType: 3,
		              poolType: 2,
		              day: this.dayvalue,
		              times: parseInt(this.form1.number2 / 10),
		              saveOrderCount: this.form1.number3,
		            };
		          } else {
		            _data = {
		              tradeType: 1,
		              orderType: 3,
		              poolType: 2,
		              day: this.form1.day,
		              times: parseInt(this.form1.number2 / 10),
		              saveOrderCount: this.form1.number3,
		            };
		          }
		        }
		        // 不限量极速
		        if (this.form1.type == 5) {
		          if (this.form1.day == 1) {
		            _data = {
		              tradeType: 1,
		              orderType: 3,
		              poolType: 3,
		              day: this.dayvalue,
		              times: 1,
		              saveOrderCount: this.form1.number3,
		            };
		          } else {
		            _data = {
		              tradeType: 1,
		              orderType: 3,
		              poolType: 3,
		              day: this.form1.day,
		              times: 1,
		              saveOrderCount: this.form1.number3,
		            };
		          }
		        }
		      }
		      // 动态转发
		      if (this.showItem == 2) {
		        if (this.form1.type2 == 1) {
		          _data = {
		            tradeType: 1,
		            poolType: 1,
		            orderType: 4,
		            day: 0,
		            times: parseInt(this.form2.multiple / 100000),
		            saveOrderCount: this.form1.number3,
		          };
		        }
		        if (this.form1.type2 == 2) {
		          _data = {
		            tradeType: 1,
		            poolType: 2,
		            orderType: 4,
		            day: 0,
		            times: parseInt(this.form2.multiple / 100000),
		            saveOrderCount: this.form1.number3,
		          };
		        }
		      }
		      // 转发按并发
		      if (this.showItem == "8") {
		        _data = {
		          tradeType: 1,
		          orderType: 8,
		          day: this.form1.day,
		          times: this.form1.times,
		          saveOrderCount: this.form1.number3,
		        };
		      }
		      // 转发按量
		      if (this.showItem == "4") {
		        _data = {
		          tradeType: 1,
		          orderType: 4,
		          day: 0,
		          times: parseInt(this.form2.multiple / 100000),
		          saveOrderCount: this.form1.number3,
		        };
		      }
		      // 独享代理
		      if (this.showItem == "3") {
		        if (this.form1.day == 1) {
		          _data = {
		            tradeType: 1,
		            poolType: 1,
		            orderType: 5,
		            day: this.dayvalue,
		            times: 1,
		            saveOrderCount: this.form1.number3,
		          };
		        } else {
		          _data = {
		            tradeType: 1,
		            poolType: 1,
		            orderType: 5,
		            day: this.form1.day,
		            times: 1,
		            saveOrderCount: this.form1.number3,
		          };
		        }
		      }
		      //虚拟
		      if (this.showItem == "11") {
		        if (
		          this.form3.minutes == 180 ||
		          this.form3.minutes == 720 ||
		          this.form3.minutes == 1440
		        ) {
		          _data = {
		            tradeType: 1,
		            orderType: 11,
		            day: 0,
		            times: parseInt(this.form3.multiple2 / 100),
		            minute: this.form3.minutes,
		            saveOrderCount: this.form1.number3,
		          };
		        } else {
		          _data = {
		            tradeType: 1,
		            orderType: 11,
		            day: 0,
		            times: parseInt(this.form3.multiple / 100),
		            minute: this.form3.minutes,
		            saveOrderCount: this.form1.number3,
		          };
		        }
		      }
		      //长效
		      if (this.showItem == "7") {
		        if (this.form1.ipType == 1) {
		          if (this.form1.day == 1) {
		            _data = {
		              tradeType: 1,
		              orderType: 7,
		              day: this.dayvalue,
		              times: this.form1.multipleTy7,
		              city: 0,
		              poolType: this.form1.ipType,
		              saveOrderCount: this.form1.number3,
		            };
		          } else {
		            _data = {
		              tradeType: 1,
		              orderType: 7,
		              day: this.form1.day,
		              times: this.form1.multipleTy7,
		              city: 0,
		              poolType: this.form1.ipType,
		              saveOrderCount: this.form1.number3,
		            };
		          }
		        }
		        if (this.form1.ipType == 2) {
		          _data = {
		            tradeType: 1,
		            orderType: 7,
		            day: this.form1.day,
		            times: this.form1.multipleTy7,
		            city: 0,
		            poolType: this.form1.ipType,
		            saveOrderCount: this.form1.number3,
		          };
		        }
		      }
		      //全局
		      if (this.showItem == "12") {
		        if (this.form1.day == 1) {
		          _data = {
		            tradeType: 1,
		            orderType: 12,
		            day: this.dayvalue,
		            times: this.form1.multipleTy7,
		            poolType: 1,
		            saveOrderCount: this.form1.number3,
		          };
		        } else {
		          _data = {
		            tradeType: 1,
		            orderType: 12,
		            day: this.form1.day,
		            times: this.form1.multipleTy7,
		            poolType: 1,
		            saveOrderCount: this.form1.number3,
		          };
		        }
		      }
		      //加速器
		      if (this.showItem == "14") {
		        _data = {
		          tradeType: 1,
		          orderType: 14,
		          day: this.form1.day14,
		          times: this.form1.timesNum,
		          saveOrderCount: this.form1.number3,
		        };
		      }
		      //加速器
		      if (this.showItem == "16") {
		        _data = {
		          tradeType: 1,
		          orderType: 14,
		          day: this.form1.day14,
		          saveOrderCount: this.form1.number3,
		          poolType: 2,
		          times: -1,
		        };
		      }
		      // 高效代理
		      if (
		        (this.showItem == 15 && this.form1.type15 == 1) ||
		        (this.showItem == 15 && this.form1.type15 == 2) ||
		        (this.showItem == 15 && this.form1.type15 == 3)
		      ) {
		        // 不限量企业
		        _data = {
		          tradeType: 1,
		          orderType: 15,
		          poolType: this.form1.type15,
		          day: 0,
		          times: parseInt(this.form1.multiple15 / 1000),
		          saveOrderCount: this.form1.number3,
		        };
		      }
		      if (
		        (this.showItem == 15 && this.form1.type15 == 4) ||
		        (this.showItem == 15 && this.form1.type15 == 5) ||
		        (this.showItem == 15 && this.form1.type15 == 6)
		      ) {
		        // 不限量企业
		        _data = {
		          tradeType: 1,
		          orderType: 15,
		          poolType: this.form1.type15,
		          day: 0,
		          times: parseInt(this.form1.multiple16 / 100),
		          saveOrderCount: this.form1.number3,
		        };
		      }
			   await this.$store
					.dispatch("Caculate",_data)
					.then((response) => {
						if (response.data.code == "0") {
						  payMoney = response.data.obj-tar;
						  this.money = payMoney;
						  if( this.money <0){
							   this.money =0
						  }
						  
						}	
					})
		      payMoney=this.money;
		      return payMoney;
		    },	   
		},
		watch: {
			showItem: function (newVal) {
		      this.getlistUseableCoupon();
		    },
		    "form1.type": function (newVal) {
		      this.getlistUseableCoupon();
		    },
		    "form1.type15": function (newVal) {
		      this.getlistUseableCoupon();
		    },
		    "form1.type2": function (newVal) {
		      this.getlistUseableCoupon();
		    },
		    "form1.ipType": function (newVal) {
		      this.getlistUseableCoupon();
		    },
		    "form1.day": function (newVal) {
		      this.getlistUseableCoupon();
		    },
		    "form1.day14": function (newVal) {
		      this.getlistUseableCoupon();
		    },
		    "form1.timesNum": function (newVal) {
		      this.getlistUseableCoupon();
		    },
		    "form1.timesNum": {
		      handler: function () {
		        if (this.form1.timesNum > 29) {
		          this.form1.day14Type = 2;
		        } else {
		          this.form1.day14Type = 1;
		        }
		        this.getlistUseableCoupon();
		      },
		      deep: true,
		    },
		    "form1.times": function (newVal) {
		      this.getlistUseableCoupon();
		    },
		    "form3.minutes": function (newVal) {
		      this.getlistUseableCoupon();
		    },
		    "form1.multiple": function (newVal) {
		      this.getlistUseableCoupon();
		    },
		    "form1.multiple15": function (newVal) {
		      this.getlistUseableCoupon();
		    },
		    "form1.multiple16": function (newVal) {
		      this.getlistUseableCoupon();
		    },
		    "form3.multiple": function (newVal) {
		      this.getlistUseableCoupon();
		    },
		    "form3.multiple2": function (newVal) {
		      this.getlistUseableCoupon();
		    },
		    "form1.multipleTy7": function (newVal) {
		      this.getlistUseableCoupon();
		    },
		    "form1.number": function (newVal) {
		      this.getlistUseableCoupon();
		    },
		    "form1.number2": function (newVal) {
		      this.getlistUseableCoupon();
		    },
		    "form1.number3": function (newVal) {
		      this.getlistUseableCoupon();
		    },
		    dayvalue: function (newVal) {
		      this.getlistUseableCoupon();
		    },
		    "form2.multiple": function (newVal) {
		      this.getlistUseableCoupon();
		    },
		    "form1.city": function (newVal) {
		      this.getlistUseableCoupon();
		    },
		    "form1.city2": function (newVal) {
		      this.getlistUseableCoupon();
		    },
		    "form1.multipleTy7": {
		      handler: function () {
		        if (this.form1.multipleTy7 > 9 && this.form1.multipleTy7 <= 39) {
		          this.form1.day7Type = 2;
		        } else if (this.form1.multipleTy7 > 39 && this.form1.multipleTy7 <= 79) {
		          this.form1.day7Type = 3;
		        } else if (this.form1.multipleTy7 > 79) {
		          this.form1.day7Type = 4;
		        } else {
		          this.form1.day7Type = 1;
		        }
		        this.getlistUseableCoupon();
		      },
		      deep: true,
		    },
		    coupon: {
		      handler: function () {
		        this.overMo();
		      },
		      async: true,
		    },
		    'payType': function (newVal) {
		      if (newVal == "3") {
		        this.couponDis = true;
		        this.coupon = "0";
				this.selecValue4="不使用优惠"
				this.couponList=[{ label: "不使用优惠", value: 0 }]
		      }else {
		        this.couponDis = false;
				this.getlistUseableCoupon()
		      }
			  
		    },
		},
		methods: {
			overMo(){
				this.payMoney.then()
			},
			formatDate2(str, type){
				    var oDate = new Date(str),
				        oYear = oDate.getFullYear(),
				        oMonth = oDate.getMonth() + 1,
				        oDay = oDate.getDate(),
				        oHour = oDate.getHours();
				    var oMin = oDate.getMinutes(),
				        oSen = oDate.getSeconds();
				    oMonth = oMonth >= 10 ? oMonth : '0' + oMonth;
				    // oDay = oDay >= 10 ? oDay : '0'+oDay;
				    oHour = oHour >= 10 ? oHour : '0' + oHour;
				    oMin = oMin >= 10 ? oMin : '0' + oMin;
				    oDay = oDay >= 10 ? oDay : '0' + oDay;
				    oSen = oSen >= 10 ? oSen : '0' + oSen;
				    var oTime = oYear + '-' + oMonth + '-' + oDay; // 最后拼接时间
				    if (type && type == 2) {
				        return oYear + '-' + oMonth + '-' + oDay + ' ' + oHour + ':' + oMin
				    }
				    return oTime;
				},
			couponQrCode(data) {
				console.log(data);
							new QRCode('myQrcode', {
								text: data,
								width: 100,
								height: 100,
								colorDark: "#333333",
								colorLight: "#FFFFFF",
								correctLevel: QRCode.CorrectLevel.H
							})
						},
			selectOne1(options) {
			    this.selecValue1 =options.label
				this.showItem=options.value
				if(this.showItem==1){
					this.form1.type=1
				}
			},
			selectOne2(options) {
			    this.selecValue2 =options.label
				this.form1.ipType=options.value
			},
			selectOne3(options) {
			    this.selecValue3 =options.label
				this.form1.day=options.value
			},
			selectOne4(options) {
			    this.selecValue4 =options.label
				this.coupon=options.value
			},
			selectOne5(options) {
			    this.selecValue5 =options.label
				this.form1.type=options.value
			},
			selectOne6(options) {
			    this.selecValue6 =options.label
				this.form1.type15=options.value
			},
			selectOne7(options) {
			    this.selecValue7 =options.label
				this.form1.day14=options.value
			},
			selectOne8(options) {
			    this.selecValue8 =options.label
				this.form1.minutes=options.value
			},
			selectOne9(options) {
			    this.selecValue9 =options.label
				this.form1.ipType=options.value
			},
			useOutClickSide() {
			    this.$refs.easySelect.hideOptions && this.$refs.easySelect.hideOptions()
			},
			getlistUseableCoupon() {
			      let that = this;
			      if (this.showItem == 14) {
			        this.getCaculate();
			        this.getCaculate14();
			      }
			      this.payMoney
			        .then(function (result) {
			          let _data = { limitMoney: result, usedType: 0 };
			          // 按量
			          if (that.showItem == 1 && that.form1.type == 1) {
			            _data = { limitMoney: result, usedType: 1 };
			          }
			          // 包时
			          if (that.showItem == 1 && that.form1.type == 2) {
			            _data = { limitMoney: result, usedType: 2 };
			          }
			          // 不限量个人
			          if (that.showItem == 1 && that.form1.type == 3) {
			            _data = { limitMoney: result, usedType: 3, poolType: 1 };
			          }
			          // 不限量企业
			          if (that.showItem == 1 && that.form1.type == 4) {
			            _data = { limitMoney: result, usedType: 3, poolType: 2 };
			          }
			          // 转发按并发
			          if (that.showItem == 8) {
			            _data = { limitMoney: result, usedType: 8 };
			          }
			          // 转发按量
			          if (that.showItem == 4) {
			            _data = { limitMoney: result, usedType: 4 };
			          }
			          // 虚拟
			          if (that.showItem == 11) {
			            _data = { limitMoney: result, usedType: 11 };
			          }
			          // 长效24
			          if (that.showItem == 7) {
			            _data = { limitMoney: result, usedType: 7 };
			          }
			          // 全局
			          if (that.showItem == 12) {
			            _data = { limitMoney: result, usedType: 12 };
			          }
			          // jiasuuqi
			          if (that.showItem == 14) {
			            _data = { limitMoney: result, usedType: 14 };
			          }
			          // 按量升级
			          if (that.showItem == 15) {
			            _data = { limitMoney: result, usedType: 15 };
			          }
					  that.$store
					    .dispatch("ListUseableCoupon",_data)
					    .then((response) => {
							if(response.data.code==0){
								let tarr = response.data.obj;
								if (tarr.length > 0) {
								  let arr = [{ label: "不使用优惠", value: 0 }];
								  tarr.forEach((item) => {
								    let obj = {
								      label: item.money + "元(截止" + that.formatDate2(item.endTime, 2) + ")",
								      value: item.id,
									  price:item.money
								    };
								    arr.push(obj);
								  });
								  that.couponList = arr;
								}
							}
						})
			        })
			        .catch(function (error) {
			          // error==上面的error
			        });
			    },
			change(num){
				this.payType=num
			},
			radioChange(num){
				this.form1.day14Type=num
				if (this.form1.day14Type == 1) {
					if (this.form1.timesNum > 29) {
						this.form1.timesNum = 2;
					}
				} else {
					if (this.form1.timesNum < 31) {
						this.form1.timesNum = 30;
					}
				}  
			},
			radioChange2(num){
				this.form1.day7Type=num
				if (this.form1.day7Type == 1) {
			        if (this.form1.multipleTy7 > 9 || this.form1.multipleTy7 < 1) {
			          this.form1.multipleTy7 = 1;
			        }
			      }
			      if (this.form1.day7Type == 2) {
					  this.form1.multipleTy7 = 10;
			        if (this.form1.multipleTy7 > 39 || this.form1.multipleTy7 < 10) {
			          this.form1.multipleTy7 = 10;
			        }
			      }
			      if (this.form1.day7Type == 3) {
			        if (this.form1.multipleTy7 > 79 || this.form1.multipleTy7 < 40) {
			          this.form1.multipleTy7 = 40;
			        }
			      }
			      if (this.form1.day7Type == 4) {
			        if (this.form1.multipleTy7 < 80) {
			          this.form1.multipleTy7 = 80;
			        }
			    }
			},
			getCaculate() {
			let that = this;
			  let _data = {};
			  if (this.showItem == "14") {
			    _data = {
			      tradeType: 1,
			      orderType: 14,
			      day: this.form1.day14,
			      times: 30,
			    };
			  }
				that.$store
				  .dispatch("Caculate",_data)
				  .then((response) => {
					  if(response.data.code==0){
					  	that.payMoney1402 =response.data.obj;
					  }
				  })
			},
			getCaculate14() {
			  let that = this;
			  let _data = {};
			  if (this.showItem == "14") {
			    _data = {
			      tradeType: 1,
			      orderType: 14,
			      day: this.form1.day14,
			      times: 1,
			    };
			  }
			  that.$store
			    .dispatch("Caculate",_data)
			    .then((response) => {
					if(response.data.code==0){
						that.payMoney14 =response.data.obj;
					}
				})
			},
			submit3(){
				let obj;
				// 优质
				if (this.showItem == 1) {
				  // 按量
				  if (this.form1.type == 1) {
				    obj = {
				      tradeType: 1,
				      orderType: 1,
				      day: 0,
				      times: parseInt(this.form1.multiple / 1000),
				      saveOrderCount: this.form1.number3,
				    };
				  }
				  // 包时
				  if (this.form1.type == 2) {
				    obj = {
				      tradeType: 1,
				      orderType: 2,
				      day: this.form1.day,
				      times: parseInt(this.form1.multiple / 1000),
				      saveOrderCount: this.form1.number3,
				    };
				  }
				  // 不限量个人
				  if (this.form1.type == 3) {
				    if (this.form1.day == 1) {
				      obj = {
				        tradeType: 1,
				        orderType: 3,
				        poolType: 1,
				        day: this.dayvalue,
				        times: parseInt(this.form1.number / 5),
				        saveOrderCount: this.form1.number3,
				      };
				    } else {
				      obj = {
				        tradeType: 1,
				        orderType: 3,
				        poolType: 1,
				        day: this.form1.day,
				        times: parseInt(this.form1.number / 5),
				        saveOrderCount: this.form1.number3,
				      };
				    }
				  }
				  // 不限量企业
				  if (this.form1.type == 4) {
				    if (this.form1.day == 1) {
				      obj = {
				        tradeType: 1,
				        orderType: 3,
				        poolType: 2,
				        day: this.dayvalue,
				        times: parseInt(this.form1.number2 / 10),
				        saveOrderCount: this.form1.number3,
				      };
				    } else {
				      obj = {
				        tradeType: 1,
				        orderType: 3,
				        poolType: 2,
				        day: this.form1.day,
				        times: parseInt(this.form1.number2 / 10),
				        saveOrderCount: this.form1.number3,
				      };
				    }
				  }
				  // 不限量极速
				  if (this.form1.type == 5) {
				    if (this.form1.day == 1) {
				      obj = {
				        tradeType: 1,
				        orderType: 3,
				        poolType: 3,
				        day: this.dayvalue,
				        times: 1,
				        saveOrderCount: this.form1.number3,
				      };
				    } else {
				      obj = {
				        tradeType: 1,
				        orderType: 3,
				        poolType: 3,
				        day: this.form1.day,
				        times: 1,
				        saveOrderCount: this.form1.number3,
				      };
				    }
				  }
				}
				// 转发
				if (this.showItem == 2) {
				  if (this.form1.type2 == 1) {
				    obj = {
				      tradeType: 1,
				      poolType: 1,
				      orderType: 4,
				      day: 0,
				      times: parseInt(this.form2.multiple / 100000),
				      saveOrderCount: this.form1.number3,
				    };
				  }
				  if (this.form1.type2 == 2) {
				    obj = {
				      tradeType: 1,
				      poolType: 2,
				      orderType: 4,
				      day: 0,
				      times: parseInt(this.form2.multiple / 100000),
				      saveOrderCount: this.form1.number3,
				    };
				  }
				}
				// 转发按并发
				if (this.showItem == 8) {
				  obj = {
				    tradeType: 1,
				    orderType: 8,
				    day: this.form1.day,
				    times: this.form1.times,
				    saveOrderCount: this.form1.number3,
				  };
				}
				if (this.showItem == 4) {
				  obj = {
				    tradeType: 1,
				    orderType: 4,
				    day: 0,
				    times: parseInt(this.form2.multiple / 100000),
				    saveOrderCount: this.form1.number3,
				  };
				}
				// 独享代理
				if (this.showItem == 3) {
				  if (this.form1.day == 1) {
				    obj = {
				      tradeType: 1,
				      poolType: 1,
				      orderType: 5,
				      day: this.dayvalue,
				      times: 1,
				      saveOrderCount: this.form1.number3,
				    };
				  } else {
				    obj = {
				      tradeType: 1,
				      poolType: 1,
				      orderType: 5,
				      day: this.form1.day,
				      times: 1,
				      saveOrderCount: this.form1.number3,
				    };
				  }
				}
				//虚拟IP
				if (this.showItem == 11) {
				  if (
				    this.form3.minutes == 180 ||
				    this.form3.minutes == 720 ||
				    this.form3.minutes == 1440
				  ) {
				    obj = {
				      tradeType: 1,
				      orderType: 11,
				      day: 0,
				      times: parseInt(this.form3.multiple2 / 100),
				      minute: this.form3.minutes,
				      saveOrderCount: this.form1.number3,
				    };
				  } else {
				    obj = {
				      tradeType: 1,
				      orderType: 11,
				      day: 0,
				      times: parseInt(this.form3.multiple / 100),
				      minute: this.form3.minutes,
				      saveOrderCount: this.form1.number3,
				    };
				  }
				}
				//长效IP
				if (this.showItem == 7) {
				  if (this.form1.ipType == 1) {
				    if (this.form1.day == 1) {
				      obj = {
				        tradeType: 1,
				        orderType: 7,
				        day: this.dayvalue,
				        times: this.form1.multipleTy7,
				        city: 0,
				        poolType: this.form1.ipType,
				        saveOrderCount: this.form1.number3,
				      };
				    } else {
				      obj = {
				        tradeType: 1,
				        orderType: 7,
				        day: this.form1.day,
				        times: this.form1.multipleTy7,
				        city: 0,
				        poolType: this.form1.ipType,
				        saveOrderCount: this.form1.number3,
				      };
				    }
				  }
				  if (this.form1.ipType == 2) {
				    if (this.form1.day == 1) {
				      obj = {
				        tradeType: 1,
				        orderType: 7,
				        day: this.dayvalue,
				        times: this.form1.multipleTy7,
				        city: 0,
				        poolType: this.form1.ipType,
				        saveOrderCount: this.form1.number3,
				      };
				    } else {
				      obj = {
				        tradeType: 1,
				        orderType: 7,
				        day: this.form1.day,
				        times: this.form1.multipleTy7,
				        city: 0,
				        poolType: this.form1.ipType,
				        saveOrderCount: this.form1.number3,
				      };
				    }
				  }
				}
				//全局IP
				if (this.showItem == 12) {
				  if (this.form1.day == 1) {
				    obj = {
				      tradeType: 1,
				      orderType: 12,
				      times: this.form1.multipleTy7,
				      saveOrderCount: this.form1.number3,
				      day: this.dayvalue,
				    };
				  } else {
				    obj = {
				      tradeType: 1,
				      orderType: 12,
				      day: this.form1.day,
				      times: this.form1.multipleTy7,
				      saveOrderCount: this.form1.number3,
				    };
				  }
				}
				//加速器
				if (this.showItem == 14) {
				  obj = {
				    tradeType: 1,
				    orderType: 14,
				    day: this.form1.day14,
				    saveOrderCount: this.form1.number3,
				    times: this.form1.timesNum,
				  };
				}
				//加速器
				if (this.showItem == 16) {
				  obj = {
				    tradeType: 1,
				    orderType: 14,
				    day: this.form1.day14,
				    poolType: 2,
				    times: -1,
						
				    saveOrderCount: this.form1.number3,
				  };
				}
				// 优质
				if (
				  (this.showItem == 15 && this.form1.type15 == 1) ||
				  (this.showItem == 15 && this.form1.type15 == 2) ||
				  (this.showItem == 15 && this.form1.type15 == 3)
				) {
				  // 按量
				  obj = {
				    tradeType: 1,
				    orderType: 15,
				    day: 0,
				    poolType: this.form1.type15,
				    times: parseInt(this.form1.multiple15 / 1000),
				    saveOrderCount: this.form1.number3,
				  };
				}
				if (
				  (this.showItem == 15 && this.form1.type15 == 4) ||
				  (this.showItem == 15 && this.form1.type15 == 5) ||
				  (this.showItem == 15 && this.form1.type15 == 6)
				) {
				  // 按量
				  obj = {
				    tradeType: 1,
				    orderType: 15,
				    day: 0,
				    poolType: this.form1.type15,
				    times: parseInt(this.form1.multiple16 / 100),
				    saveOrderCount: this.form1.number3,
				  };
				}
				let that = this;
				that.$store
						.dispatch("BuildTrade",obj)
						.then((response) => {
							if(response.data.code==0){
								that.baiduwx(response.data.obj)
							}			
						})	
			},
			baiduwx(data){
				let that=this
				let orderD=data
				// let orderD='Br/XotTRG3oeGm70yOpYPNf9gFPyA0eOqTK4aQdotio0X63oWR5kAqVidOaWOSgqhOikkPFVnjYq8vgkrQFGe8vofcOCq9hMyKosSB24QXlgz3EG8GjmPsaPawaFE23zrVQg40tVW9rafb/oEQzfrtjqGRBJB8QECQj8+mh1Z99qUsZT0TZZMEiR0paBtn6zJVsVg/4fgagcOOoWWh2G9gMh467fKXYXTjAED+MvzJt7UHlfs7U+D3Ixz8kxeiTkwfxQVhxA+NgncKwmk2AecqSzM6uAnZciay4bE22cJ0UxBJROk7J56yDvyjtpal84Z7semXgZobSZV6hJ07d+Pw=='
				let  activeMoney=that.activeMoney*100 
				this.$store
				.dispatch("BaidupaySign",{chargeNo:orderD})
				.then((response) => {
					if(response.data.code==0){
						
						that.rsaSign=response.data.obj
						that.nextPay(orderD)
					}	
				  })
				  .catch(() => {});	 
				
			},
			nextPay(e) {
				let that=this
				let  activeMoney=that.money*100 
				let dtr={
					appKey:"MMU2KF",
					dealId:2566984488,
					tpOrderId:e,
					totalAmount:activeMoney,
					notifyUrl:'https://vips.xiongmaodaili.com/xiongmao-web/trade/baiduNotify',
					dealTitle:'熊猫代理',
					signFieldsRange:1,
					rsaSign:this.rsaSign
				}
			    swan.requestPolymerPayment({
			        orderInfo: dtr,
			        success: res => {
			            swan.showToast({
			                title: '支付成功',
			                icon: 'success'
			            });
			            console.log('success', res);
			        },
			        fail: err => {
			            swan.showToast({
			                title: err.errMsg,
			                icon: 'none'
			            });
			            console.log('fail', err);
			        }
			    });    
			},
			submit2() {
		      let obj;
		      // 优质
		      if (this.showItem == 1) {
		        // 按量
		        if (this.form1.type == 1) {
		          obj = {
		            tradeType: 1,
		            orderType: 1,
		            day: 0,
		            times: parseInt(this.form1.multiple / 1000),
		            saveOrderCount: this.form1.number3,
		          };
		        }
		        // 包时
		        if (this.form1.type == 2) {
		          obj = {
		            tradeType: 1,
		            orderType: 2,
		            day: this.form1.day,
		            times: parseInt(this.form1.multiple / 1000),
		            saveOrderCount: this.form1.number3,
		          };
		        }
		        // 不限量个人
		        if (this.form1.type == 3) {
		          if (this.form1.day == 1) {
		            obj = {
		              tradeType: 1,
		              orderType: 3,
		              poolType: 1,
		              day: this.dayvalue,
		              times: parseInt(this.form1.number / 5),
		              saveOrderCount: this.form1.number3,
		            };
		          } else {
		            obj = {
		              tradeType: 1,
		              orderType: 3,
		              poolType: 1,
		              day: this.form1.day,
		              times: parseInt(this.form1.number / 5),
		              saveOrderCount: this.form1.number3,
		            };
		          }
		        }
		        // 不限量企业
		        if (this.form1.type == 4) {
		          if (this.form1.day == 1) {
		            obj = {
		              tradeType: 1,
		              orderType: 3,
		              poolType: 2,
		              day: this.dayvalue,
		              times: parseInt(this.form1.number2 / 10),
		              saveOrderCount: this.form1.number3,
		            };
		          } else {
		            obj = {
		              tradeType: 1,
		              orderType: 3,
		              poolType: 2,
		              day: this.form1.day,
		              times: parseInt(this.form1.number2 / 10),
		              saveOrderCount: this.form1.number3,
		            };
		          }
		        }
		        // 不限量极速
		        if (this.form1.type == 5) {
		          if (this.form1.day == 1) {
		            obj = {
		              tradeType: 1,
		              orderType: 3,
		              poolType: 3,
		              day: this.dayvalue,
		              times: 1,
		              saveOrderCount: this.form1.number3,
		            };
		          } else {
		            obj = {
		              tradeType: 1,
		              orderType: 3,
		              poolType: 3,
		              day: this.form1.day,
		              times: 1,
		              saveOrderCount: this.form1.number3,
		            };
		          }
		        }
		      }
		      // 转发
		      if (this.showItem == 2) {
		        if (this.form1.type2 == 1) {
		          obj = {
		            tradeType: 1,
		            poolType: 1,
		            orderType: 4,
		            day: 0,
		            times: parseInt(this.form2.multiple / 100000),
		            saveOrderCount: this.form1.number3,
		          };
		        }
		        if (this.form1.type2 == 2) {
		          obj = {
		            tradeType: 1,
		            poolType: 2,
		            orderType: 4,
		            day: 0,
		            times: parseInt(this.form2.multiple / 100000),
		            saveOrderCount: this.form1.number3,
		          };
		        }
		      }
		      // 转发按并发
		      if (this.showItem == 8) {
		        obj = {
		          tradeType: 1,
		          orderType: 8,
		          day: this.form1.day,
		          times: this.form1.times,
		          saveOrderCount: this.form1.number3,
		        };
		      }
		      if (this.showItem == 4) {
		        obj = {
		          tradeType: 1,
		          orderType: 4,
		          day: 0,
		          times: parseInt(this.form2.multiple / 100000),
		          saveOrderCount: this.form1.number3,
		        };
		      }
		      // 独享代理
		      if (this.showItem == 3) {
		        if (this.form1.day == 1) {
		          obj = {
		            tradeType: 1,
		            poolType: 1,
		            orderType: 5,
		            day: this.dayvalue,
		            times: 1,
		            saveOrderCount: this.form1.number3,
		          };
		        } else {
		          obj = {
		            tradeType: 1,
		            poolType: 1,
		            orderType: 5,
		            day: this.form1.day,
		            times: 1,
		            saveOrderCount: this.form1.number3,
		          };
		        }
		      }
		      //虚拟IP
		      if (this.showItem == 11) {
		        if (
		          this.form3.minutes == 180 ||
		          this.form3.minutes == 720 ||
		          this.form3.minutes == 1440
		        ) {
		          obj = {
		            tradeType: 1,
		            orderType: 11,
		            day: 0,
		            times: parseInt(this.form3.multiple2 / 100),
		            minute: this.form3.minutes,
		            saveOrderCount: this.form1.number3,
		          };
		        } else {
		          obj = {
		            tradeType: 1,
		            orderType: 11,
		            day: 0,
		            times: parseInt(this.form3.multiple / 100),
		            minute: this.form3.minutes,
		            saveOrderCount: this.form1.number3,
		          };
		        }
		      }
		      //长效IP
		      if (this.showItem == 7) {
		        if (this.form1.ipType == 1) {
		          if (this.form1.day == 1) {
		            obj = {
		              tradeType: 1,
		              orderType: 7,
		              day: this.dayvalue,
		              times: this.form1.multipleTy7,
		              city: 0,
		              poolType: this.form1.ipType,
		              saveOrderCount: this.form1.number3,
		            };
		          } else {
		            obj = {
		              tradeType: 1,
		              orderType: 7,
		              day: this.form1.day,
		              times: this.form1.multipleTy7,
		              city: 0,
		              poolType: this.form1.ipType,
		              saveOrderCount: this.form1.number3,
		            };
		          }
		        }
		        if (this.form1.ipType == 2) {
		          if (this.form1.day == 1) {
		            obj = {
		              tradeType: 1,
		              orderType: 7,
		              day: this.dayvalue,
		              times: this.form1.multipleTy7,
		              city: 0,
		              poolType: this.form1.ipType,
		              saveOrderCount: this.form1.number3,
		            };
		          } else {
		            obj = {
		              tradeType: 1,
		              orderType: 7,
		              day: this.form1.day,
		              times: this.form1.multipleTy7,
		              city: 0,
		              poolType: this.form1.ipType,
		              saveOrderCount: this.form1.number3,
		            };
		          }
		        }
		      }
		      //全局IP
		      if (this.showItem == 12) {
		        if (this.form1.day == 1) {
		          obj = {
		            tradeType: 1,
		            orderType: 12,
		            times: this.form1.multipleTy7,
		            saveOrderCount: this.form1.number3,
		            day: this.dayvalue,
		          };
		        } else {
		          obj = {
		            tradeType: 1,
		            orderType: 12,
		            day: this.form1.day,
		            times: this.form1.multipleTy7,
		            saveOrderCount: this.form1.number3,
		          };
		        }
		      }
		      //加速器
		      if (this.showItem == 14) {
		        obj = {
		          tradeType: 1,
		          orderType: 14,
		          day: this.form1.day14,
		          saveOrderCount: this.form1.number3,
		          times: this.form1.timesNum,
		        };
		      }
		      //加速器
		      if (this.showItem == 16) {
		        obj = {
		          tradeType: 1,
		          orderType: 14,
		          day: this.form1.day14,
		          poolType: 2,
		          times: -1,
		
		          saveOrderCount: this.form1.number3,
		        };
		      }
		      // 优质
		      if (
		        (this.showItem == 15 && this.form1.type15 == 1) ||
		        (this.showItem == 15 && this.form1.type15 == 2) ||
		        (this.showItem == 15 && this.form1.type15 == 3)
		      ) {
		        // 按量
		        obj = {
		          tradeType: 1,
		          orderType: 15,
		          day: 0,
		          poolType: this.form1.type15,
		          times: parseInt(this.form1.multiple15 / 1000),
		          saveOrderCount: this.form1.number3,
		        };
		      }
		      if (
		        (this.showItem == 15 && this.form1.type15 == 4) ||
		        (this.showItem == 15 && this.form1.type15 == 5) ||
		        (this.showItem == 15 && this.form1.type15 == 6)
		      ) {
		        // 按量
		        obj = {
		          tradeType: 1,
		          orderType: 15,
		          day: 0,
		          poolType: this.form1.type15,
		          times: parseInt(this.form1.multiple16 / 100),
		          saveOrderCount: this.form1.number3,
		        };
		      }
		      let that = this;
			  that.$store
			  		.dispatch("BuildTrade",obj)
			  		.then((response) => {
						if (response.data.code == "0"&&that.payType == "6"&&that.money!=0) {
							// #ifdef MP-WEIXIN
							that.wxpay(response.data.obj)
							// #endif
							// #ifdef  MP-ALIPAY
							// that.AliPay(response.data.obj)
							// #endif 
						}
						if (response.data.code == "0"&&that.payType == "5"&&that.money!=0) {
							// #ifdef  MP-ALIPAY
							that.AliPay(response.data.obj)
							// #endif 
						}
						if(response.data.code == "0"&&that.money==0){
							// #ifdef MP-WEIXIN
							that.payType=2
							// #endif
							// #ifdef  MP-ALIPAY
							that.payType=1
							// #endif 
							let tar={
							          payWay: that.payType,
							          chargeNo: response.data.obj,
							          couponId: that.coupon,
							        }
							that.$store
								.dispatch("TradeBuy",tar)
								.then((response) => {
									if(response.data.code==0){
										uni.navigateTo({
											url: "/pagesA/user/orderList"
										})
										uni.showToast({
											title:"订单购买成功"
										})
									}else{
										that.$store.commit("SET_ERRORINFORMATION", {
										  mes: response.data.msg,
										  icon: "error",
										});
									}
									  
								})
						}
			  			if (response.data.code == "0"&&that.payType == "3") {
							let tar =this.coupon == "0"? { payWay: that.payType, chargeNo: response.data.obj }
							      : {
							          payWay: that.payType,
							          chargeNo: response.data.obj,
							          couponId: that.coupon,
							        };
							that.$store
								.dispatch("TradeBuy",tar)
								.then((response) => {
									if(response.data.code==0){
										// 钱包
										if (that.payType == "3") {
											setTimeout(function() {
												uni.showToast({
													title:"支付成功",
												})
											}, 1000);											
											uni.navigateTo({
												url: "/pagesA/user/orderList"
											})
										}    
									}else{
										that.$store.commit("SET_ERRORINFORMATION", {
										  mes: response.data.msg,
										  icon: "error",
										});
									}
									  
								})
			  			}
							
			  		})			
		    },
			AliPay(data){
				let that=this
				let orderD=data
				let  activeMoney=that.money*100
				uniCloud.callFunction({
				    name: 'user-common2',
					data:{
						totalFee: activeMoney, 
						outTradeNo:data,
						openid:uni.getStorageSync("alipayId").id,
						subject:'熊猫代理'
					},				
				    success(res) {		
						console.log("成功1233",res.result.orderInfo);
						uni.requestPayment({
							orderInfo: res.result.orderInfo,
							success(){
								that.getisSuccess(orderD)
							},
							fail(){
								that.getisSuccess(orderD)
							}																							 																																 
						})			   
				    },
					fail(){
						that.getisSuccess(orderD)
					}
				})	
			},
			wxpay(data){				
				let that=this
				let orderD=data
			   that.openid=uni.getStorageSync("wxId").id
			   let  activeMoney=that.money*100
			   uniCloud.callFunction({
			       name: 'user-common',
					data:{
						totalFee: activeMoney, 
						outTradeNo:data,
						openid:that.openid,
						subject:''
					},
			       success(res) {
					   uni.requestPayment({
						   ...res.result.orderInfo,
							success(){
								that.getisSuccess(orderD)
							},
							fail(){
								that.getisSuccess(orderD)
							}
					   })
			       },
				   fail(){
					   that.getisSuccess(orderD)
				   }
			   })
			},
			getisSuccess(data){
				let that=this
				let obj={
					chargeNo:data
				}
				that.$store
					.dispatch("IsSuccess",obj)
					.then((response) => {
					})
			},
			get(){
				let that=this
				that.$store
					.dispatch("GetMoney")
					.then((response) => {
					})
			},
			inputN(type,max){
				let that=this
				if(type==1){
					if(that.form1.times>100){
						that.form1.times=100
					}else if(that.form1.times<5||that.form1.times==''){
						that.form1.times=5
					}
				}else if(type==2){
					// if(this.form1.multiple%1000<1000){
					// 	let sum=Math.ceil(this.form1.multiple/1000)*1000
					// 	this.form1.multiple=sum
					// }
					// console.log(Math.ceil(this.form1.multiple/1000)*1000);
					// console.log(this.form1.multiple%1000);
				}else if(type==8){
					if(that.form1.timesNum>=max){
						that.form1.timesNum=1000000
					}else if(that.form1.timesNum<2){
						that.form1.timesNum=2
					}	
				}
			},
			add(type,num1,num2){
				let that=this
				if(type==1){
					if(that.form1.times<num2){
						that.form1.times=this.form1.times+1
					}else{
						that.form1.times=100
					}
				}else if(type==2){
					if(this.form1.multiple<num2){
						this.form1.multiple=this.form1.multiple+num1
					}else{
						this.form1.multiple=num2
					}
				}else if(type==3){
					if(this.form1.multiple15<num2){
						this.form1.multiple15=this.form1.multiple15+num1
					}else{
						this.form1.multiple15=num2
					}
				}else if(type==4){
					if(this.form1.multiple16<num2){
						this.form1.multiple16=this.form1.multiple16+num1
					}else{
						this.form1.multiple16=num2
					}
				}else if(type==5){
					if(this.form3.multiple<num2){
						this.form3.multiple=this.form3.multiple+num1
					}else{
						this.form3.multiple=num2
					}
				}else if(type==6){
					if(this.form3.multiple2<num2){
						this.form3.multiple2=this.form3.multiple2+num1
					}else{
						this.form3.multiple2=num2
					}
				}else if(type==7){
					if(this.form1.multipleTy7<num2){
						this.form1.multipleTy7=this.form1.multipleTy7+num1
					}else{
						this.form1.multipleTy7=num2
					}
				}else if(type==8){
					if(this.form1.timesNum<num2){
						this.form1.timesNum=this.form1.timesNum+num1
					}else{
						this.form1.timesNum=num2
					}
				}else if(type==9){
					if(this.form1.number<num2){
						this.form1.number=this.form1.number+num1
					}else{
						this.form1.number=num2
					}
				}else if(type==10){
					if(this.form1.number2<num2){
						this.form1.number2=this.form1.number2+num1
					}else{
						this.form1.number2=num2
					}
				}else if(type==11){
					if(this.form2.multiple<num2){
						this.form2.multiple=this.form2.multiple+num1
					}else{
						this.form2.multiple=num2
					}
				}else if(type==12){
					if(this.form1.number3<num2){
						this.form1.number3=this.form1.number3+num1
					}else{
						this.form1.number3=num2
					}
				}else if(type==13){
					if(this.dayvalue<num2){
						this.dayvalue=this.dayvalue+num1
					}else{
						this.dayvalue=num2
					}
				}		
			},
			reduce(type,num1,num2){				
				if(type==1){
					if(this.form1.times>num1){
						this.form1.times=this.form1.times-1
					}else{
						this.form1.times=num1
					}	
				}else if(type==2){
					if(this.form1.multiple>num1){
						this.form1.multiple=this.form1.multiple-num1
					}else{
						this.form1.multiple=num1
					}
				}else if(type==3){
					if(this.form1.multiple15>num1){
						this.form1.multiple15=this.form1.multiple15-num1
					}else{
						this.form1.multiple15=num1
					}
				}else if(type==4){
					if(this.form1.multiple16>num1){
						this.form1.multiple16=this.form1.multiple16-num1
					}else{
						this.form1.multiple16=num1
					}
				}else if(type==5){
					if(this.form3.multiple>num1){
						this.form3.multiple=this.form3.multiple-num1
					}else{
						this.form3.multiple=num1
					}
				}else if(type==6){
					if(this.form3.multiple2>num1){
						this.form3.multiple2=this.form3.multiple2-num1
					}else{
						this.form3.multiple2=num1
					}
				}else if(type==7){
					if(this.form1.multipleTy7>num1){
						this.form1.multipleTy7=this.form1.multipleTy7-num1
					}else{
						this.form1.multipleTy7=num1
					}
				}else if(type==8){
					if(this.form1.timesNum>2){
						this.form1.timesNum=this.form1.timesNum-num1
					}else{
						this.form1.timesNum=2
					}
				}else if(type==9){
					if(this.form1.number>num1){
						this.form1.number=this.form1.number-num1
					}else{
						this.form1.number=num1
					}
				}else if(type==10){
					if(this.form1.number2>num1){
						this.form1.number2=this.form1.number2-num1
					}else{
						this.form1.number2=num1
					}
				}
				else if(type==11){
					if(this.form2.multiple>num1){
						this.form2.multiple=this.form2.multiple-num1
					}else{
						this.form2.multiple=num1
					}
				}else if(type==12){
					if(this.form1.number3>num1){
						this.form1.number3=this.form1.number3-num1
					}else{
						this.form1.number3=num1
					}
				}else if(type==13){
					if(this.dayvalue>num1){
						this.dayvalue=this.dayvalue-num1
					}else{
						this.dayvalue=num1
					}
				}			
			}
		},
	}
</script>

<style lang="less">
#order{
	width: 94%;
	margin: 0 auto;
	padding-bottom: 100rpx;
	.codewx{
		height: 200rpx;
		padding-left: 24rpx;
		position: relative;
		.canvas{
				width: 200upx;height: 200upx;
			}
		.text{
			position: absolute;
			right: 35%;
			top: 40%;
			color: #007AFF;
		}
	}
	.item{
		margin-bottom: 40rpx;
		.easy-select{
			border: none;
			display: inline-block;
			font-size: 24rpx !important;
			// color: red;
			position: relative;
			top: 20rpx;
			input{
				font-size: 24rpx !important;
			}
		}
	}
	.title{
		display: inline-block;
		width: 200rpx;
		font-size: 28rpx;
	}
	select{
		width: 100%;
		border: none;
		text-align: right;
		color: #a9a9a9;
		font-size: 28rpx;
	}
	.input{
		width: 100rpx;
		// background: ;
		display: inline-block;
	}
	.block{
		display: inline-block;
		height: 48rpx;
		line-height: 48rpx;			
		overflow: hidden;
		padding: 0 10rpx;
		input{
			display: inline-block;
			width: 160rpx;
			height: 48rpx;
			line-height: 48rpx;
			text-align: center;
		}
	}
	.add,.reduce{
		padding: 2rpx 14rpx;
		color: #666;
		background-color: #F1F3F4;
	}
	.iblock{
		width: 400rpx;
		margin-left: 20rpx;
		margin-top: 20rpx;
		text-align: right;
		display: inline-block;
		.numberBox{
			width: 460rpx;
			text-align: right;
			justify-content: flex-end;
			.uni-numbox__value, .uni-input-input{
				width: 300rpx;
			}
		}
	}
	.iblock2{
		box-sizing: border-box;
		padding-left: 10rpx;
		text-align: left;
	}
	.grouptit{
		width: 140rpx;
		position: relative;
		top: 4rpx;
		
	}
	radio-group{
		margin-top: 20rpx;
	}
	.radio{
		font-size: 24rpx;
		display: inline-block;
		height: 48rpx;
		border-radius: 400rpx;
		margin-right: 40rpx;
	}
	.radio2{
		display: inline-block;
	}
	.itmrad{
		display: inline-block;
		border-radius: 14rpx;
		padding: 4rpx;
		border: 2rpx solid #dcdfe6;
		box-sizing: border-box;
		margin-right: 0rpx;
		font-size: 24rpx;
		position: relative;
		image{
			position: absolute;
			top: 0;
			right: 0;
			width: 30rpx;
			height: 24rpx;
		}
	}
	.itmrad1{
		padding: 6rpx 8rpx;
		margin-right: 8rpx;
	}
	.groud{
		background: #007AFF;
		color: #FFFFFF;
	}
	.groud1{
		margin-left: 10rpx;
	}
	.day7Type_line {
	    width: 80rpx;
	    height: 2rpx;
	    background-color: #dcdfe6;
	    margin: 0 auto;
	    margin-top: 10rpx;
	}
	.day7Type_num {
		text-align: center;
	    font-size: 24rpxpx;
	    margin-top: 10rpx;
	}
	.part2{
		margin-top: 20rpx;
	}
	.active{
		padding-left: 24rpx;
		height: 100rpx;
		line-height: 100rpx;
		text{
			display: inline-block;
			width: 460rpx;
		}
		input{
			display: inline-block;
			// color: #FFFFFF;
		}
		.im{
			display: inline-block;
		}
		image{
			width: 30rpx;
			height: 30rpx;
			margin-right: 10rpx;
			position: relative;
			top: 5rpx;
		}	
	}
	.prompt_text{
	    background-color: #FFF8E8;
	    font-size: 26rpx;
	    color: #E78258;
	    padding: 20rpx;
	    margin-bottom: 20rpx;  
	}
	.prompt_text2{
	    color:rgb(72, 110, 245);
	    font-size: 26rpx;
	}
	.btn{
		margin-top: 50rpx;
		button{
			border: none;
			width: 80%;
			border-radius: 70rpx;
			background: #007AFF;
		}
	}
}
</style>
